#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

#include <string>
#include <memory.h>
#include <iostream>

#include "xsn.h"
#include "xsnExtractor.h"

int main(int argc,char* argv[])
{
	xsn::NodePtr node = xsn::Node::create();
	node->set("node");
	xsn::NodePtr node2 = xsn::Node::create("childNode");	
	xsn::NodePtr node3 = xsn::Node::create("child node");
	xsn::NodePtr node4 = xsn::Node::create("test node [child node]");
	xsn::NodePtr node5 = xsn::Node::create("node;\n node;\n");
	xsn::NodePtr node6 = xsn::Node::create("parent[child1;\n child2;\n]");
	xsn::NodePtr node7 = xsn::Node::create("parent node[child node1;\n child node2;\n]");	

	xsn::NodePtr node3Next = node3->getAttrib(1);
	node2->attachChild(node3);
	node2->attachAttrib(node4->getAttrib(1));

	xsn::NodePtr node2Dup = node2->duplicateTree();
	node2Dup->set("added nodes");
	node2Dup->set("mod [newchild] ");
	node2Dup->set(5);
	std::cout << node2Dup;	

	xsn::NodePtr testNode = xsn::Node::createFromFile("../../../res/xsnTest/test3.xsn");
	std::cout << testNode;		

	xsn::NodePtr simpleTest = xsn::Node::create("root[ tini 0; tono 1; ]");	
	std::cout << simpleTest;	

	return 0;
}